package no.ntnu.fp.mmi;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import javax.swing.JPanel;

import no.ntnu.fp.su.Message;

/**Model for MessagePanel to use when you are creating a message to be sent
 * 
 * @author Jaspreet
 *
 */
@SuppressWarnings("serial")
public class MessageModel extends JPanel {
	

	public static final String MessageProperty = "message";
	
	PropertyChangeSupport pcs;
	private Message message;
	
	
	
	public MessageModel (Message message){
		pcs = new PropertyChangeSupport(this);
	}

	public Message getMessage() {
		return message;
	}

	public void setMessage(Message message) {
		Message old = this.message;
		this.message = message;
		pcs.firePropertyChange(MessageProperty, old, message);
	}
	
	
	public void addPropertyChangeListener(PropertyChangeListener listener) {
		pcs.addPropertyChangeListener(listener);
	}
	
	
}
